<div class="content-warp">
  <div class="content-header">
    <i class="anticon anticon-left-circle-o" (click)="goBack()"></i>
    <span class="content-title">{{isEdit?'编辑':'新建'}}</span>
  </div>
  <div class="content-body">
    <div nz-row>
      <div nz-col [nzSpan]="17">
        <form nz-form [formGroup]="validateForm">
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>店铺简称：</div>
            <div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('name')">
              <nz-input formControlName="name" [nzPlaceHolder]="'请输入店铺简称'" [nzSize]="'large'">
              </nz-input>
              <div nz-form-explain *ngIf="getFormControl('name').dirty&&getFormControl('name').hasError('required')">
                请输入店铺简称
              </div>
            </div>
          </div>
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>店铺地址：</div>
            <div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('name')">
              <nz-input formControlName="address" [nzPlaceHolder]="'请输入店铺地址'" [nzSize]="'large'">
              </nz-input>
              <div nz-form-explain
                   *ngIf="getFormControl('address').dirty&&getFormControl('address').hasError('required')">
                请输入店铺地址
              </div>
            </div>
          </div>
          <!--<div nz-form-item nz-row>-->
            <!--<div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>经度：</div>-->
            <!--<div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('longitude')">-->
              <!--<nz-input formControlName="longitude" [nzPlaceHolder]="'请输入经度'" [nzSize]="'large'">-->
              <!--</nz-input>-->
            <!--</div>-->
          <!--</div>-->
          <!--<div nz-form-item nz-row>-->
            <!--<div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>纬度：</div>-->
            <!--<div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('latitude')">-->
              <!--<nz-input formControlName="latitude" [nzPlaceHolder]="'请输入纬度'" [nzSize]="'large'">-->
              <!--</nz-input>-->
            <!--</div>-->
          <!--</div>-->
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>复制商品：</div>
            <div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('name')">
              <nz-select
                style="width: 200px;"
                [nzPlaceHolder]="'选择店铺'"
                [nzShowSearch]="true"
                [(ngModel)]="copy_id" (nzOpenChange)="checkType($event)"
                [ngModelOptions]="{standalone: true}"
                [nzDisabled]="isEdit"
              >
                <nz-option
                  *ngFor="let option of shopList"
                  [nzLabel]="option.name"
                  [nzValue]="option.id"></nz-option>

              </nz-select>
            </div>
          </div>
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>营业时间：</div>
            <div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('name')">
              <nz-radio-group formControlName="is_time_limit">
                <label nz-radio [nzValue]="0">
                  <span>限制营业时间</span>
                </label>
                <label nz-radio [nzValue]="1">
                  <span>无限制</span>
                </label>
              </nz-radio-group>
              <div *ngIf="getFormControl('is_time_limit').value === 0">
                <nz-input-number formControlName="opened_at" [nzMin]="0" [nzMax]="24" [nzStep]="1"></nz-input-number>
                至
                <nz-input-number formControlName="closed_at" [nzMin]="0" [nzMax]="24" [nzStep]="1"></nz-input-number>
              </div>
              <div nz-form-explain
                   *ngIf="getFormControl('opened_at').dirty&&getFormControl('closed_at').dirty&&getFormControl('closed_at').value<getFormControl('opened_at').value">
                结束时间不能比开始时间短
              </div>
            </div>
          </div>
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzSm]="6" [nzXs]="24" nz-form-item-required>业务范围：</div>
            <div nz-form-control nz-col [nzSm]="12" [nzXs]="24" [nzValidateStatus]="getFormControl('send_type')">
              <nz-radio-group formControlName="send_type">
                <label nz-radio [nzValue]="0">
                  <span>不限</span>
                </label>
                <label nz-radio [nzValue]="1">
                  <span>自提</span>
                </label>
                <label nz-radio [nzValue]="2">
                  <span>仅外卖</span>
                </label>
              </nz-radio-group>
            </div>
          </div>
          <div nz-form-item nz-row style="margin-bottom:8px;">
            <div nz-form-control nz-col [nzSpan]="14" [nzOffset]="6">
              <button nz-button [nzSize]="'large'" [nzType]="'primary'" [nzLoading]="submitStatus"
                      (click)="_submitForm()">{{ submitStatus ? btnState+'中': btnState }}
              </button>
              <button nz-button [nzSize]="'large'" [nzType]="'default'" type="button" (click)="goBack()"
                      style="margin-left: 20px">取 消
              </button>
            </div>
          </div>
        </form>
      </div>
      <div nz-col [nzSpan]="7">
        <div class="preview-title">{{ previewTitle }}</div>
        <div class="preview-subtitle">{{ previewsubTitle }}</div>
        <img style="margin-top:10px;" src="{{ 'assets/images/' + previewSrc + '.png' }}" alt="">
      </div>
    </div>
  </div>
</div>
